import { defineStore } from "pinia";

export const useMainStore = defineStore('main',{
    state:()=>({
        author:"hyx",
        fontSize:0,
        theme: 'rgb(250, 250, 252)'
    }),

    getters:{
        authorX:(state) => state.author + 'change'
    },

    actions: {
        reset() {
           this.author = ''
        },
        setFontSize(radio) {
            this.fontSize = radio
        },
        setTheme(color){
            if(!!color){
                this.theme = color
            }else{
                this.theme = 'rgb(250, 250, 252)'
            }
           
        },
    },
})

export const useLoginStore = defineStore('login',{
    state:()=>({
      token:"",
    }),

    getters:{
        tokenVal:(state) => state.token,
        isLogin:(state) => state.token==''?false:true
    },

    actions: {
      setToken(tk) {
        this.token = tk
      }
    },
})